#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
long long n,a[200005],b[200005],c,f,s;
int main()
{
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	cin>>n;
	s=n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		b[i]=1;
	}
	while(s>0)
	{
	for(int i=1;i<=n;i+=c)
	{
		c=1;
		if(b[i]==1)
		{
			cout<<i<<" ";
		f=a[i];
		for(int j=i;j<=n;j++)
		{
			if(a[j]!=f&&b[j]==1)
			{
				c--;
				break;
			}
			c++;
		}
		s--;
		b[i]=0;
		}
	}
	cout<<endl;
    }
    fclose(stdin);
	fclose(stdout);
	return 0;
}
